﻿@using LKVMLMLib;
@using PagedList.Mvc;
@{
    ViewBag.Title = "CashOut";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}
@using (Html.BeginForm("CashOut", "CongCu", FormMethod.Get, new { @class = "form-inline" }))
{
    <div id="wrapper">
        <div class="clear-fix"></div>
        <div class="row">
            <div style=" min-height: 110px; padding-left: 30px; ">
                <h3 class="page-header">Danh sách</h3>
                @Html.DropDownList("_Status",@ViewBag.StatusWD as IEnumerable<SelectListItem>, new { @class = "form-control" })
                <button type="submit" class="btn_submit btn btn-default">Tìm kiếm</button>
            </div>
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel-body">
                    <div class="dataTable_wrapper">
                        <label style="color:orangered">@ViewBag.Error</label>
                        <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                            <thead>
                                <tr style="font-family:'Times New Roman'">
                                    <th>STT</th>
                                    <th>UserName</th>
                                    <th>Ngày tạo</th>
                                    <th>Số lượng</th>
                                    <th>Bank</th>
                                    <th>Kiểu thanh toán</th>
                                    <th>Trạng thái</th>
                                    <th style="width:150px;">Tùy chọn</th>
                                </tr>
                            </thead>
                            <tbody style="font-family:'Times New Roman'">
                                @{int j = 0;}
                                @foreach (var item in ViewBag.ListWD)
                                {
                                    j++;
                                    <tr>
                                        <td>@j</td>
                                        <td>@item.UserName</td>
                                        @if (item.CreateDate != null)
                                        {
                                            <td>@String.Format("{0:d/MM/yyyy}", item.CreateDate)</td>
                                        }
                                        else
                                        {
                                            <td>@item.CreateDate</td>
                                        }
                                        <td>@item.Amount</td>
                                        <td>@item.Payer</td>
                                        <td>@item.Payment_Method_Name</td>
                                        @if (item.Status == 0)
                                        {
                                            <td>Pending</td>
                                        }
                                        else if (item.Status == 1)
                                        {
                                            <td>Approve</td>
                                        }
                                        else
                                        {
                                            <td>Cancel</td>
                                        }
                                        @if (item.Status == 0)
                                        {
                                            <td>
                                                <a href="@Url.Action("ApprovePM", "CongCu", new { _wdId = item.Id, _status = item.Status, _method = item.PayMent_Method, _userId = item.UserId, _amount = item.Amount })" >Approve</a>&nbsp&nbsp;
                                                <a href="@Url.Action("CancelPM", "CongCu", new { _wdId = item.Id, _status = item.Status, _userId = item.UserId, _amount = item.Amount, _walletId = item.WalletId })">Cancel</a>
                                            </td>
                                        }
                                    </tr>
                                }


                            </tbody>

                        </table>
                    </div>
                </div>
            </div>
            <!-- /.panel -->
        </div>
    </div>
    <div class="dataTables_paginate paging_full_numbers pull-right" id="dyntable_paginate">
        @Html.PagedListPager((PagedList.IPagedList)Model, page => Url.Action("CashOut", new { page }))
    </div>
}
